package com.chixing.service.impl;

import com.chixing.mapper.ItineraryPlanMapper;
import com.chixing.mapper.TravelSightsMapper;
import com.chixing.pojo.ItineraryPlan;
import com.chixing.pojo.ItineraryPlanSightsVO;
import com.chixing.pojo.TravelSights;
import com.chixing.service.ItineraryPlanService;
import com.chixing.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ItineraryPlanServiceImpl implements ItineraryPlanService {
    @Autowired
    private ItineraryPlanMapper itineraryPlanMapper;
    @Autowired
    private TravelSightsMapper travelSightsMapper;
    @Override
    public ServerResponse getItineraryTosalesById(Integer id) {
        ItineraryPlan itineraryPlan = itineraryPlanMapper.selectByPrimaryKey(id);
        ItineraryPlanSightsVO itineraryPlanSightsVO = new ItineraryPlanSightsVO();
        itineraryPlanSightsVO.setItineraryPlan(itineraryPlan);
        TravelSights travelSights = travelSightsMapper.selectByPrimaryKey(itineraryPlan.getTravelSightsId());
        itineraryPlanSightsVO.setTravelSights(travelSights);
        System.out.println(itineraryPlanSightsVO);
        return ServerResponse.getSuccess(itineraryPlanSightsVO);
    }
}
